Skip to content

Possible solution for missing light fixtures#667

Open
joshuarwood wants to merge 2 commits intofgsfdsfgs:portfrom
joshuarwood:datadyne_research_light_loc_fix
Open

Possible solution for missing light fixtures#667
joshuarwood wants to merge 2 commits intofgsfdsfgs:portfrom
joshuarwood:datadyne_research_light_loc_fix

Conversation

@joshuarwood
Copy link
Copy Markdown

This PR contains a possible solution for some of the missing lights in certain levels. The idea is to shift the position of problematic lights slightly so they pass the line-of-sight test for visibility. This is needed since the original position is very close or just behind the background geometry, which fails the line-of-sight test.

The shift is performed inside bgBuildTables, which is only called when loading background data at the beginning of the level. It should not impact performance once the player is in the level. The shifts are small enough (the minimum size of 1 allowed by the vec3s16 light position) that they should be indistinguishable from the original light position.

So far I've implemented fixes for lights in dataDyne Research: Investigation since it had the largest number of missing lights on my playthrough. I included comparison images below. I can add fixes for additional levels if you approve of this approach.

Images from PC port

Broken lights from dataDyne Research: Investigation in the current PC port

pc_room21_light0 pc_room46_47_light0 pc_room52_light0 pc_room53_light0 pc_room62_light0 pc_room71_light0 pc_room73_light0 pc_room74_light0 pc_room75_76_light0 pc_room77_light0 pc_room80_light3 pc_room98_light0

Images from this PR

Fixed lights after adjusting positions with this PR

pr_room21_light0 pr_room46_47_light0 pr_room52_light0 pr_room53_light0 pr_room62_light0 pr_room71_light0 pr_room73_light0 pr_room74_light0 pr_room75_76_light0 pr_room77_light0 pr_room80_light3 pr_room98_light0

@fgsfdsfgs
Copy link
Copy Markdown
Owner

It would be nice to find a solution that does not require hardcoding light shifts per stage. Stages can be replaced after all.

@joshuarwood
Copy link
Copy Markdown
Author

Could you point me towards an example of how to replace the stage? Does it involve swapping out a binary from the ROM?

@Nyxem64
Copy link
Copy Markdown

Nyxem64 commented Nov 23, 2025

Could you point me towards an example of how to replace the stage? Does it involve swapping out a binary from the ROM?

https://github.com/fgsfdsfgs/perfect_dark/wiki/Modding#asset-files
PerfectGold / GoldEditor / GoldenEye Setup Editor can extract the file. If you need guidance for how to use that, let me know.

@joshuarwood
Copy link
Copy Markdown
Author

Oh, excellent. Many thanks!

@joshuarwood
Copy link
Copy Markdown
Author

I followed the g5_carpark example and put together a .zip containing a modified background geometry with fixes for the 14 lights from the Investigation level that were included in this PR:

investigation_light_fix.zip

It should work with ntsc-final builds using

./pd.x86_64 --moddir investigation_light_fix

Does anyone want to test it out?

It should also fix #665.

@joshuarwood
Copy link
Copy Markdown
Author

Oh, I forgot to include some screenshots from the editor for documentation purposes. Here is a before & after screenshot for one of the problematic lights:

Before

Screenshot 2025-12-01 231024

After

Screenshot 2025-12-01 231100

The shift is 1 unit down for all 4 corners of the light, which is enough to avoid triggering the line-of-sight test on the surface of the light without being noticeable when playing the game.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants